package org.lintcode_Close.Stage1_Easy_50.O2判断语句;

import java.util.Arrays;

/**
 * @Auther: qingle
 * @Date: 2024/8/17-2:42
 * @Description:
 * @version: 1.0
 */
public class 三数之中的最大值 {

	public int maxOfThreeNumbers(int num1, int num2, int num3) {
		// write your code here
		int max = num1;
		if (num1 < num2) {
			max = num2;
		}
		if (num3 > max) {
			max = num3;
		}
		return max;
	}

	public int maxOfThreeNumbers2(int num1, int num2, int num3) {
		// write your code here
		int[] num = {num1,num2,num3};
		Arrays.sort(num);
		return num[num.length-1];
	}

	public static void main(String[] args) {
		int num1 = 1, num2 = 9, num3 = 0;
		System.out.println(new 三数之中的最大值().maxOfThreeNumbers(num1, num2, num3));
		System.out.println(new 三数之中的最大值().maxOfThreeNumbers2(num1, num2, num3));
	}
}
